<template>
	<view>
		<view class="img_top">
			<uni-nav-bar fixed class="nav" background-color="" status-bar="true" :border="false"
				title="商家中心"></uni-nav-bar>
			<image class="bcg" src="/static/user/u1.png" mode=""></image>
			<view class="abs" @click="goset">
				<view class="flex_b">
					<image :src="shopInfo.logo? shopInfo.logo :'/static/logo.png'" mode=""></image>
					<view class="">
						<view class="name">
							{{shopInfo.shopName}}
						</view>
						<view class="flex_b">
							<span>{{shopInfo.rating}}</span>
							<uni-rate :size="18" color="#fff" readonly :value="shopInfo.rating" active-color="#000" />
						</view>
					</view>
				</view>
				<uni-icons type="right" color="#0CAD61"></uni-icons>
			</view>
		</view>
		<view class="block_1">
			<view class="b_1" @click="pagemoney">
				<image class="abs" src="/static/user/u2.png" mode=""></image>
				<view class="flex_b tit" >
					<span>可提现金额(元)</span>
					<uni-icons size="12" color="#fff" type="right"></uni-icons>
				</view>
				<view class="flex_b" style="margin-top: 10rpx;">
					<view class="price">
						{{money1}}
					</view>
					<view class="r_img">
						<image src="/static/user/u3.png" mode=""></image>
						<view class="abspr">
							在途金额 <span>{{money3}}</span>
						</view>
					</view>
				</view>
				<view class="b_5">
					<image src="/static/user/u5.png" mode=""></image>
					<view class="abs">
						<view class="its">
							<view class="t1">今日营业额(元)</view>
							<view class="t2">{{money2}}</view>
						</view>
						<view class="its">
							<view class="t1">累计额(元)</view>
							<view class="t2">{{shopInfo.amountSum}}</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="block_2">
			<view class="ulist">
				<view class="item" v-for="(item,index) in ulist" :key="index" @click="pagego(item,index)">
					<view class="flex_b">
						<image :src="item.icon" mode=""></image>
						<view class="flex_b">
							<view class="">
								{{item.uname}}
							</view>
						</view>
					</view>
					<button v-if='index==3' open-type="contact"></button>
					<uni-icons type="right"></uni-icons>
				</view>
			</view>
		</view>
		<uv-tabbar :value="3" class="tab"></uv-tabbar>
	</view>
</template>

<script>
	import {
		getShopinfo,money1,money2,money3
	} from '@/common/http.api.js';
	export default {
		data() {
			return {
				ulist: [{
						uname: '评价管理',
						icon: require('../../static/user/ui1.png'),
						path: '/pages/user/comment'
					},
					{
						uname: '商品库存',
						icon: require('../../static/user/ui2.png'),
						path: '/pages/user/inventory'
					},
					{
						uname: '店铺管理',
						icon: require('../../static/user/ui3.png'),
						path: '/pages/user/setshop'
					},
					{
						uname: '联系客服',
						icon: require('../../static/user/ui4.png'),
						path: '/mypage/commentandz'
					},
					{
						uname: '账号设置',
						icon: require('../../static/user/ui5.png'),
						path: '/pages/user/setaccount'
					}
				],
				shopInfo:{},
				money1:0,
				money2:0,
				money3:0,
			}
		},
		onShow() {
			getShopinfo({}).then(res=>{
				uni.setStorageSync('userinfo',res.data)
				this.shopInfo = res.data
			})
			this.getInfo()
		},
		methods:{
			getInfo(){
				money1({}).then(res=>{
					if(res.code == 200){
						this.money1 =res.data.amount
					}
				})
				money2({}).then(res=>{
					if(res.code == 200){
						this.money2 =res.data.amount
					}
				})
				money3({}).then(res=>{
					if(res.code == 200){
						this.money3 =res.data.amount
					}
				})
			},
			goset(){
				uni.navigateTo({
					url:'/pages/user/setshop'
				})
			},
			pagego(item,index){
			    if(index==3){
					
				}else{
					uni.navigateTo({
						url:item.path
					})
				}
			},
			pagemoney(){
				uni.navigateTo({
					url:'/pages/user/money'
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background: #fff;
	}

	.nav {
		position: fixed;
		top: 0%;
		z-index: 99;
		width: 100%;
	}

	.img_top {
		position: relative;
		height: 418rpx;

		.bcg {
			width: 100%;
			height: 418rpx;
			position: fixed;
			top: 0%;
		}

		.abs {
			width: 690rpx;
			position: absolute;
			bottom: 112rpx;
			left: 30rpx;
			display: flex;
			font-family: 'DINB';
			font-weight: bold;
			font-size: 30rpx;
			color: #000000;
			align-items: center;
			justify-content: space-between;

			image {
				width: 80rpx;
				height: 80rpx;
				border-radius: 6rpx;
				margin-right: 20rpx;
			}

			.name {
				font-family: PingFang SC, PingFang SC;
				font-weight: bold;
				font-size: 32rpx;
				color: #000000;
			}
		}
	}

	.block_1 {
		width: 750rpx;
		position: absolute;
		background: #FFFFFF;
		border-radius: 20rpx 20rpx 0rpx 0rpx;
		margin-top: -70rpx;
		padding: 30rpx;
		box-sizing: border-box;

		.b_1 {
			width: 690rpx;
			height: 340rpx;
			background: linear-gradient(224deg, #C1FFDD 0%, #64E19D 44%, #3DAC6F 100%);
			border-radius: 20rpx 20rpx 20rpx 20rpx;
			position: relative;
			padding: 28rpx 20rpx;
			box-sizing: border-box;

			.abs {
				position: absolute;
				width: 206rpx;
				height: 224rpx;
				right: 0;
				top: 0%;
			}

			.tit {
				font-family: PingFang SC, PingFang SC;
				font-weight: 500;
				font-size: 24rpx;
				color: #FFFFFF;
			}

			.price {
				font-family: 'DINB';
				font-weight: bold;
				font-size: 60rpx;
				color: #FFFFFF;
			}

			.r_img {
				width: 268rpx;
				height: 52rpx;
				position: relative;
				margin-left: 20rpx;

				image {
					width: 268rpx;
					height: 52rpx;
				}

				.abspr {
					position: absolute;
					width: 268rpx;
					height: 52rpx;
					top: 0%;
					padding: 0rpx 0rpx 0rpx 36rpx;
					box-sizing: border-box;
					font-family: PingFang SC, PingFang SC;
					font-weight: 500;
					font-size: 24rpx;
					color: #1E703F;
					line-height: 52rpx;

					span {
						font-family: 'DINB';
						font-weight: bold;
						font-size: 32rpx;
						margin-left: 10rpx;
					}
				}
			}

			.b_5 {
				margin-top: 5rpx;
				position: absolute;
				width: 650rpx;
				height: 162rpx;

				image {
					width: 650rpx;
					height: 162rpx;
				}

				.abs {
					width: 650rpx;
					height: 162rpx;
					position: absolute;
					display: flex;
					top: 0;
					padding: 55rpx 40rpx 0rpx 40rpx;
					box-sizing: border-box;

					.its {
						width: 50%;

						.t1 {
							font-family: PingFang SC, PingFang SC;
							font-weight: 500;
							font-size: 24rpx;
							color: #0CAD61;
						}

						.t2 {
							font-family: 'DINB';
							font-size: 40rpx;
							color: #0CAD61;
							margin-top: 10rpx;
						}
					}
				}
			}
		}

	}

	.block_2 {
		margin-top: 320rpx;
		padding:0rpx 30rpx 0rpx 20rpx;
		.ulist {
			.item {
				display: flex;
				justify-content: space-between;
				align-items: center;
				font-family: PingFang SC, PingFang SC;
				font-size: 28rpx;
				color: #000000;
				margin-bottom: 28rpx;
				image {
					width: 80rpx;
					height: 80rpx;
					margin-right: 6rpx;
				}
				.rig {
					width: 40rpx;
					height: 40rpx;
				}
			}
			.item:nth-child(6) {
				margin-top: 60rpx;
			}
			button {
				position: absolute;
				width: 710rpx;
				height: 60rpx;
				opacity: 0.1;
			}
			button::after {
				border: none;
			}
		}
	}
</style>